Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ffi_call function with a similar signature to pure_callback. #21743

Closed
wants to merge 1 commit into from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jun 7, 2024

Add ffi_call function with a similar signature to pure_callback.

This could be useful for supporting the most common use cases for FFI custom
calls. It has several benefits over using the Primitive based approach, but
the biggest one (in my opinion) is that it doesn't require interacting with
mlir at all. It does have the limitation that transforms would need to be
registered using interfaces like custom_vjp, but many users of custom calls
already do that.

The easiest to-do item (I think) is to implement batching using a
vectorized parameter like pure_callback, but we could also think about more
sophisticated vmapping interfaces in the future.
Done.

The more difficult to-do is to think about how to support sharding, and we
might actually want to expose an interface similar to the one from
custom_partitioning. I have less experience with this part so I'll have to
think some more about it, and feedback would be appreciated!

@copybara-service copybara-service bot force-pushed the test_641313727 branch 3 times, most recently from d7e427b to b935a54 Compare June 11, 2024 02:43
This could be useful for supporting the most common use cases for FFI custom
calls. It has several benefits over using the `Primitive` based approach, but
the biggest one (in my opinion) is that it doesn't require interacting with
`mlir` at all. It does have the limitation that transforms would need to be
registered using interfaces like `custom_vjp`, but many users of custom calls
already do that.

~~The easiest to-do item (I think) is to implement batching using a
`vectorized` parameter like `pure_callback`, but we could also think about more
sophisticated vmapping interfaces in the future.~~ Done.

The more difficult to-do is to think about how to support sharding, and we
might actually want to expose an interface similar to the one from
`custom_partitioning`. I have less experience with this part so I'll have to
think some more about it, and feedback would be appreciated!

PiperOrigin-RevId: 641313727
@dfm
Copy link
Collaborator

dfm commented Jun 17, 2024

Closing in favor of #21925

@dfm dfm closed this Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant